{extend name="$base" /}
{block name="resources"}
<link rel="stylesheet" type="text/css" href="WAP_CSS/member_index.css">
<style>
	.account-num {
		margin: 10px 0px;
	}
	.account-num ul{
		display: flex;
		padding: 20px 0px;
		box-sizing: border-box;
	}
	.account-num ul li{
		flex: 1;
		text-align: center;
		color: white;
	}

	.operation-wrapper {
		background-color: white;
	}
	.operation-item {
		display: flex;
		height: 54px;
	}
	.icon-wrapper {
		flex: 0 0 50px;
	}
	.s-center {
		display: flex;
		justify-content: center;
		align-items: center;
	}
	.text-wrapper {
		flex: 1;
	}
	.arrow-right {
		flex: 0 0 50px;
	}
	.operation-text {
		width: 100%;
	}
</style>
{/block}
{block name="head" }{/block}
{block name="main" }
{php}
	$member_detail 	   = api('System.Member.memberInfo');
	$member_info  	   = $member_detail['data'];

	// 会员账户信息
	$member_account = api("System.Member.memberAccount");
	$member_account = $member_account['data'];

	// 会员等级信息
	$member_level = api("System.Member.memberLevel", ['level_id' => $member_info['member_level']]);
	$member_level = $member_level['data'];

	$member_min_level = api("System.Member.memberMinLevel", ['level_id' => $member_info['member_min_level']]);
	$member_min_level = $member_min_level['data'];

    // 累计佣金
	$member_all_salary = api("System.Member.memberAllSalary");
    $member_all_salary = $member_all_salary['data'];

	//待审核金额
	$member_withdraw_account = api("System.Member.withdrawAccount");
	$member_withdraw_account = $member_withdraw_account['data'];

	if(addon_is_exit('NsMemberSign')){
		$isSign = api("NsMemberSign.MemberSign.isSignIn");
		$isSign = $isSign['data'];
	}

	$coupon_count = api("System.Member.couponNum");
	$coupon_count = $coupon_count['data'];

	$wapEntrance = api("System.Config.wapEntrance");
	$wapEntrance = $wapEntrance['data'];


	$discounts_adv = api('System.Shop.advDetail', ['ap_keyword' => 'WAP_MEMBER', 'export_type' => 'data']);

{/php}
<div class="panel memberhead">
	<div class="member-head ns-bg-color">
		<div class="member-edit">
			<img src="WAP_IMG/member/member-icon-edit.png" onclick="location.href='{:__URL('APP_MAIN/member/info')}'">
		</div>
		<div class="member-head-top">
			<div class="member-headimg ns-border-color-gray">
				{if condition="$member_info['user_info']['user_headimg'] eq ''"}
				<img src="{:__IMG($default_headimg)}" />
				{else/}
				<img src="{:__IMG($member_info['user_info']['user_headimg'])}"/>
				{/if}
			</div>
			<div class="member-info">

				<div class="member-name" style="font-size: 14px">ID:{$member_info["user_info"]['user_name']}</div>
				<div class="member-name">{$member_info["user_info"]['nick_name']}
					<div class="member-level">{$member_level['level_name']}</div>
					{if condition="$member_min_level['min_level_name'] neq '无'"}
						<div class="member-level" style="margin-left: 2px!important;">{$member_min_level['min_level_name']}</div>
					{/if}
<!--					{if condition="$member_account['credit']"}-->
<!--					<div style="font-size: 14px;margin-top: 7px">{:lang('member_credit')}{$member_account['credit']}</div>-->
<!--					{/if}-->

				</div>

			</div>

		</div>
		<div class="account-num">
			<ul style="display: flex">
				<li>
					<div>
						<a href="{:__URL('APP_MAIN/member/balance')}">
							<div>{$member_account['balance']}</div>
							<div>{:lang('member_balance')}</div>
						</a>
					</div>
				</li>
				<li style="border-left: 1px white solid">
					<div>
						<a href="{:__URL('APP_MAIN/member/point')}">
							<div>{$member_account['point']}</div>
							<div>{:lang('member_integral')}</div>
						</a>
					</div>
				</li>
				<li style="border-left: 1px white solid">
					<div>
						<a>
							<div>{$member_account['coin']}</div>
							<div>{:lang('member_coin')}</div>
						</a>
					</div>
				</li>
			</ul>
		</div>
	</div>


	<div class="member-order top-lef radius-wrapper">
	 	<div class="member-order-head ns-border-color-gray-fadeout-50">
	 		<a href="{:__URL('APP_MAIN/order/lists')}">
	 		<div class="ns-text-color-black order-head-left">全部订单</div>
	 		<div class="order-head-right ns-text-color-gray">查看全部订单<i class="fa fa-angle-right ns-text-color-gray"></i></div>
	 		</a>
	 		<div class="clear"></div>
	 	</div>
	 	<div class="member-order-list">
	 		{php}
				$order_status_num = api("System.Order.orderCount",['order_status' => 0]);
				$wait_pay = $order_status_num['data'];
	 		{/php}
	 		<a href="{:__URL('APP_MAIN/order/lists?status=0')}">
			 	<div class="member-order-item ns-border-color-gray-fadeout-50">
			 		{if $wait_pay > 99}
			 			<div class="order-num ns-bg-color">99+</div>
					{elseif $wait_pay > 0}
				 		<div class="order-num ns-bg-color">{$wait_pay}</div>
					{/if}
			 		<div class="order-icon"><img src="WAP_IMG/member/order-icon-0.png"></div>
			 		<div class="order-text">{:lang('member_pending_payment')}</div>
		 		</div>
	 		</a>

	 		{php}
				$order_status_num = api("System.Order.orderCount",['order_status' => 1]);
				$wait_delivery = $order_status_num['data'];
	 		{/php}
	 		<a href="{:__URL('APP_MAIN/order/lists?status=1')}">
			 	<div class="member-order-item ns-border-color-gray-fadeout-50">
			 		{if $wait_delivery > 99}
				 		<div class="order-num ns-bg-color">99+</div>
			        {elseif $wait_delivery > 0}
				 		<div class="order-num ns-bg-color">{$wait_delivery}</div>
			        {/if}
			 		<div class="order-icon"><img src="WAP_IMG/member/order-icon-1.png"></div>
			 		<div class="order-text">{:lang('member_shipment_pending')}</div>
		 		</div>
	 		</a>

	 		{php}
				$order_status_num = api("System.Order.orderCount",['order_status' => 2]);
				$wait_recieved = $order_status_num['data'];
	 		{/php}
	 		<a href="{:__URL('APP_MAIN/order/lists?status=2')}">
			 	<div class="member-order-item ns-border-color-gray-fadeout-50">
			 		{if $wait_recieved > 99}
			 		<div class="order-num ns-bg-color">99+</div>
			        {elseif $wait_recieved > 0}
			 		<div class="order-num ns-bg-color">{$wait_recieved}</div>
			        {/if}
			 		<div class="order-icon"><img src="WAP_IMG/member/order-icon-2.png"></div>
			 		<div class="order-text">{:lang('member_goods_received')}</div>
		 		</div>
	 		</a>
	 		<a href="{:__URL('APP_MAIN/order/lists?status=3')}">
			 	<div class="member-order-item ns-border-color-gray-fadeout-50">
			 		<div class="order-icon"><img src="WAP_IMG/member/order-icon-3.png"></div>
			 		<div class="order-text">{:lang('member_received_goods')}</div>
		 		</div>
	 		</a>

	 		{php}
				$order_status_num = api("System.Order.orderCount",['order_status' => -1]);
				$refunding = $order_status_num['data'];
	 		{/php}
	 		<a href="{:__URL('APP_MAIN/order/lists?status=-1')}">
			 	<div class="member-order-item ns-border-color-gray-fadeout-50">
			 		{if $refunding > 99}
			 		<div class="order-num ns-bg-color">99+</div>
			        {elseif $refunding > 0}
			 		<div class="order-num ns-bg-color">{$refunding}</div>
			        {/if}
			 		<div class="order-icon"><img src="WAP_IMG/member/order-icon-4.png"></div>
			 		<div class="order-text">{:lang('refund_after_sale')}</div>
		 		</div>
	 		</a>
	 		<div class="clear"></div>
	 	</div>
	</div>

	<div class="group-list-box radius-wrapper" style="margin-top: 10px">
		{notempty name="$discounts_adv['data']"}
		<div class="swiper-container">
			<div class="swiper-wrapper">
				{foreach name="$discounts_adv['data']['advs']" item="vo"}
				<div class="swiper-slide">
					{if is_url($vo['adv_url'])}
					<a href="{$vo['adv_url']}" style="height:{$discounts_adv['data']['ap_height']}px;line-height:{$discounts_adv['data']['ap_height']}px;">
						{else/}
						<a href="{:__URL('APP_MAIN' . $vo['adv_url'])}" style="height:{$discounts_adv['data']['ap_height']}px;line-height:{$discounts_adv['data']['ap_height']}px;">
							{/if}
							<img src="{:__IMG($vo.adv_image)}" alt="{:lang('carousel_figure')}" class="w100">
						</a>
				</div>
				{/foreach}
			</div>
		</div>
		{/notempty}
		<ul class="group-list"></ul>
	</div>


	<div class="promotion-img clearfix " style="display: none">
	 	 <div class="tips border">
	 	 	<a href="{:__URL('APP_MAIN/member/registerQrCode')}">
		 	 	<div class="tips-left">
		 	 		<p class="left-text">推广商品赢奖励</p>
		 	 		<span class="">奖品多多</span>
		 	 	</div>
		 	 	<div class="p-image saml-img">
		 	 		<img src="WAP_IMG/member/p_left.png"/>
		 	 	</div>
	 	 	</a>
	 	 </div>
	 	 <div class="tips">
	 	 	<a href="{:__URL('APP_MAIN/member/registerQrCode')}">
		 	 	<div class="tips-left">
		 	 		<p class="right-text">邀请好友共推广</p>
		 	 		<span>齐心协力拉助力{$locknum}</span>
		 	 	</div>
		 	 	<div class="p-image">
		 	 		<img src="WAP_IMG/member/p_right.png"/>
		 	 	</div>
	 	 	</a>
	 	 </div>
	 </div>



	<div class="operation-wrapper radius-wrapper" >
		{notempty name="$wapEntrance"}
		{foreach name="$wapEntrance" item="vo"}
		{if is_url($vo.url)}
		<a href="{$vo.url}">
			{else/}
			<a href="{:__URL('APP_MAIN' . $vo.url)}">
				{/if}
				<div class="operation-item">
					<div class="icon-wrapper s-center">
						<div class="operation-img s-center">
							<img src="{:__IMG($vo.icon)}" style="height: 24px"/>
						</div>
					</div>
					<div class="text-wrapper s-center">
						<div class="operation-text">{$vo.title}</div>
					</div>
					<div class="arrow-right s-center">
						<i class="fa fa-angle-right ns-text-color-gray"></i>
					</div>
				</div>
			</a>
			{/foreach}
			{/notempty}
	</div>
</div>
<script>
function nfxPromoterLock(obj,islock){
	if(islock == 1){
		toast("该账户被冻结");
	}
}
</script>
{/block}
